﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Microhard.Framework.MVCHelper" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    客户订单管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="section-header">
        <div class="title">
            <img src="<%=Url.Content("~/Content/images/ico-catalog.png")%>" alt="" />
            客户订单管理
        </div>
        <div class="options">
        </div>
    </div>
    <table width="100%">
        <tr>
            <td class="adminTitle">
                <img alt="订单编号" src="<%=Url.Content("~/Content/images/ico-help.gif") %>" title="订单编号"></img><label
                    for="operationName" title="订单编号">订单编号</label>:
            </td>
            <td class="adminData">
                <%=Html.TextBox("selectedOrderCode") %>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                <img alt="门店名称" src="<%=Url.Content("~/Content/images/ico-help.gif") %>" title="门店名称"></img><label
                    for="operationName" title="门店名称">门店名称</label>:
            </td>
            <td class="adminData">
                <%=Html.TextBox("selectedKAName") %>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                <img alt="客户姓名" src="<%=Url.Content("~/Content/images/ico-help.gif") %>" title="客户姓名"></img><label
                    for="operationName" title="客户姓名">客户姓名</label>:
            </td>
            <td class="adminData">
                <%=Html.TextBox("selectedCustomerName") %>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                <img alt="配送地址" src="<%=Url.Content("~/Content/images/ico-help.gif") %>" title="配送地址"></img><label
                    for="operationName" title="配送地址">配送地址</label>:
            </td>
            <td class="adminData">
                <%=Html.TextBox("selectedAddress") %>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                <img alt="配送日期" src="<%=Url.Content("~/Content/images/ico-help.gif") %>" title="配送日期"></img><label
                    for="operationName" title="配送日期">配送日期</label>:
            </td>
            <td class="adminData">
                <%=Html.Telerik().DatePicker().Name("selectedDeliveryDate") %>
            </td>
        </tr>
    </table>
    <p>
    </p>
    <table class="adminContent">
        <tr>
            <td>
                <%Html.Telerik().Grid<Micrhard.FMCG.Server.Models.OrderModel>((List<Micrhard.FMCG.Server.Models.OrderModel>)this.Model.Data)
                    .Name("operation-grid")
                    .ToolBar(t => t.Template(g =>
                    { %>
                <%var searchParms = new Dictionary<string, string>();
                  searchParms.Add("Code", "selectedOrderCode");
                  searchParms.Add("QueryKAName", "selectedKAName");
                  searchParms.Add("QueryCustomerName", "selectedCustomerName");
                  searchParms.Add("QueryAddress", "selectedAddress");
                  searchParms.Add("QueryDeliveryDate", "selectedDeliveryDate");
                %>
                <div class="header-menu">
                    <ul class="t-widget t-reset t-header t-menu">
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_SearchButton("btnSearch", "查询", "operation-grid", searchParms, "OperationGridOnGridDataBinding")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_AddButton("btnAdd", "添加", "Create", "SaleOrder")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_UpdateButton("btnUpdate", "订单明细维护", "operation-grid", "Update", "SaleOrder", "Orders")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_DeleteButton("btnDelete", "删除", "operation-grid", "Delete", "SaleOrder", "Orders")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_UpdateButton("btnCreateWS", "派工", "operation-grid", "UpdateOrder", "OrderWorkSheet", "Orders")%>
                        </li>
                    </ul>
                </div>
                <%}))
                         .ClientEvents(events => events.OnDataBinding("OperationGridOnGridDataBinding"))
                         .Columns(columns =>
                    {
                        columns.Bound(x => x.OrderID)
                       .Template(x => Html.CheckBox("checkedRecords", new { value = x.OrderID, @class = "gridCks" }))
                       .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= OrderID #>' class='gridCks'/>")
                     .HtmlAttributes(new { style = "text-align:center" }).Title("选择");

                        columns.Bound(x => x.Code).Title("订单编号");
                        columns.Bound(x => x.CreateTime).Title("创建日期");
                        columns.Bound(x => x.OrderTypeDisplay).Title("订单类型");
                        columns.Bound(x => x.SubKA.Name).Title("卖场名称");
                        columns.Bound(x => x.Customer.Name).Title("客户姓名");
                        columns.Bound(x => x.DeliveryDate).Title("配送时间");
                        columns.Bound(x => x.DeliveryAddress).Title("地址");
                        columns.Bound(x => x.StatusDisplay).Title("订单状态");
                        columns.Bound(x => x.IsSendCoinDisplay).Title("积分赠送状态");
                    })
                      .Pageable(settings => settings.Total(Model.Total).PageSize(Html.GetGridPageSize()).Position(GridPagerPosition.Top))
                      //绑定搜索按钮，执行对应的action
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("_List", "SaleOrder"))
                    .EnableCustomBinding(true)
                    .Render();
                %>
            </td>
        </tr>
    </table>
</asp:Content>
